package net.paoding.rose.jade.rowmapper;

public class Pagination {

	private long pageSize = 0;
	private long curPage = 1;
	
	private long totalSize = 0;
	
	public long getPageSize() {
		return pageSize;
	}
	public void setPageSize(long pageSize) {
		this.pageSize = pageSize;
	}
	public long getCurPage() {
		return curPage;
	}
	public void setCurPage(long curPage) {
		this.curPage = curPage;
	}
	
	public long getTotalSize() {
		return totalSize;
	}
	public void setTotalSize(long totalSize) {
		this.totalSize = totalSize;
	}
	
	public Long getStartIndex(){
		return (this.curPage-1) * this.pageSize;
	}
	
	public Long getEndIndex(){
		long endIndex = this.curPage * this.pageSize;
		if(endIndex > this.totalSize){
			endIndex = this.totalSize;
		}
		return endIndex;
	}
}
